<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>价格设置</title>
        {include file='common/head'}
    </head>
    <body>
        <div class="layui-fluid">
            <table class="layui-table" style="width:100%;">
                <tr>
                    <td style="width:100px">批量修改价格</td>
                    <td style="width:100px"><input type="number" id="pl_price" placeholder="输入数字" class="layui-input"></td>
                    <td style="width:100px"><button onclick="set_pl()" class="layui-btn layui-btn-default">批量设置价格</button></td>
                    <td>修改后不可恢复</td>
                </tr>
                <tr>
                    <td>浮动价</td>
                    <td><input type="number" id="fd_price" value="{$fudongjia}" placeholder="输入数字" class="layui-input"></td>
                    <td><button onclick="set_fd()" class="layui-btn layui-btn-default">保存设置</button></td>
                    <td>商品展现价格+浮动价</td>
                </tr>
            </table>
        </div>
        <script>
        function set_pl()
            {
                var price=$("#pl_price").val();
                $.post("{:url('setprice')}",{type:1,price:price},function(res)
                {
                    console.log(res)
                    if(res.code==1)
                    {
                        layer.msg("保存成功");
                    }
                })
            }
            function set_fd()
            {
                var price=$("#fd_price").val();
                $.post("{:url('setprice')}",{type:2,price:price},function(res)
                {
                    console.log(res)
                    if(res.code==1)
                    {
                        layer.msg("保存成功");
                    }
                })
            }
        </script>
    </body>
</html>